<template>
  <div v-if="viewModel">
    <base-setting v-if="viewModel" v-model="viewModel"></base-setting>
    <el-form-item label="图片地址">
      <x-select-image v-model="viewModel.path"></x-select-image>
      <div class="sale-intro">请输入画布图片内容，如不上传则自动读取第一张图</div>
    </el-form-item>
  </div>
</template>
<script>
  import baseSetting from './base'
  import ala from 'ala'
export default {
    model: {
      prop: 'dataModel',
      event: 'change'
    },
    components: {
      baseSetting
    },
    props: {
      dataModel: {}
    },
    data () {
      return {
        viewModel: null
      }
    },
    mounted () {
      this.init()
    },
    methods: {
      async init () {
        this.viewModel = this.dataModel
      }
    },
    watch: {
      viewModel: {
        deep: true,
        handler (val) {
          this.$emit('change', this.viewModel)
        }
      }
    }
  }
</script>
